package com.xxcloud.search.api.impl;

import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.RequestBody;
import com.xxcloud.model.web.JobResult;
import com.xxcloud.model.web.ListResult;
import com.xxcloud.search.api.bean.note.NoteApiParameter;
import com.xxcloud.search.api.bean.note.NoteItem;
import com.xxcloud.search.api.note.INoteApiService;
import com.xxcloud.search.index.note.INoteIndexService;
import com.xxcloud.search.service.note.INoteSearchService;

/**
 * Created by chenbingwen on 19/10/31.
 */
public class NoteApiServiceImpl implements INoteApiService {

    @Resource(name = "noteIndexService")
    private INoteIndexService noteIndexService;
    @Resource(name = "noteSearchService")
    private INoteSearchService noteSearchService;

    @Override
    public ListResult<NoteItem> search(@RequestBody NoteApiParameter parameter) {
        return noteSearchService.search(parameter);
    }

    @Override
    public JobResult updateIndex(@RequestBody List<Long> noteIds) {
        return noteIndexService.updateByNoteIds(noteIds);
    }

    @Override
    public JobResult deleteIndex(@RequestBody List<Long> noteIds) {
        return noteIndexService.deleteByNoteIds(noteIds);
    }
}
